1. Field of the Invention
The present invention relates generally to computer graphics, and more particularly to the generation of texture coordinates for a surface using an ellipsoidal projective body.
2. Related Art
In the field of computer graphics, texture mapping is a well known technique for imparting realism to rendered surfaces. A surface S is amenable to this technique if there is a defined mapping M from S to a rectangular region T known as texture space. The region T is typically identified with an image whose values modulate or define, via the mapping M, rendered attributes of the surface S.
For a parametric surface EQU S(u,v)=(X(u,v), Y(u,v), Z(u,v))
such a mapping exists and is simply the inverse mapping S.sup.-1. However, for non-parametric surfaces (e.g., implicit or polygonal surfaces), such a mapping does not exist a priori. Mappings must be therefore be constructed for these non-parametric surfaces.
Planar, cylindrical or spherical projections are commonly used methods for constructing such mappings. For example, cylindrical projection mapping uses a cylinder of length L positioned so that it encloses the surface to be mapped. Each point on the cylinder can be coordinatized by (y, .theta.) where y is the distance of the point from the base of the cylinder, and .theta. is an angle that sweeps around the axis of the cylinder. Each point on the surface can be assigned the coordinate (y, .theta.) of the nearest corresponding point on the cylinder, and in this way the surface can be mapped to the rectangle [0, L].times.[0,2.pi.]. By scaling, the surface can be mapped to an arbitrary texture rectangle T.
Conventional projection mapping embeds an unmapped surface in a curvilinear coordinate system defined by a given projective body in a given position and orientation. In general we can consider a curvilinear coordinate system (u.sub.1, u.sub.2, u.sub.3), where EQU x=x(u.sub.1, u.sub.2, u.sub.3), y=y(u.sub.1, u.sub.2, u.sub.3), z=z(u.sub.1, u.sub.2, u.sub.3) EQU u.sub.1 =u.sub.1 (x,y,z), u.sub.2 =u.sub.2 (x,y,z), u.sub.3 =u.sub.3 (x,y,z)
Examples of curvilinear coordinate systems are planar (also known as cartesian), cylindrical and spherical coordinate systems. A point (x,y,z) on an unmapped surface embedded in such a curvilinear coordinate system will map to curvilinear coordinates (u.sub.1, u.sub.2, u.sub.3). By dropping one of these coordinates (which is equivalent to the mathematical operation of projection), we can coordinatize the point (x,y,z) as a pair of coordinates (u.sub.i, u.sub.j), thereby mapping the surface onto a portion of the plane.
For example, consider using a sphere of unit radius centered at the origin as a projective body. The sphere can be parameterized by the angular coordinates (.phi., .theta.), where .phi. is the azimuth angle (around the vertical z axis) and .theta. is the elevation angle (from the horizontal xy plane). Each point (x, y, z) on the unmapped surface maps to the 3D coordinates (r, .phi., .theta.). Dropping r maps the 3D coordinates to the nearest point on the sphere (.phi., .theta.), thus mapping the surface to the texture rectangle [0,2.pi.].times.[0, .pi.].
Conventional mapping systems and methods require the user to choose a projective body (i. e., a rectangle, cylinder, or sphere) and then position and orient the body around the surface which is to be mapped. Manually positioning and orienting a projective body can be time consuming and, if not done correctly, can result in mappings that either make poor use of the texture rectangle or introduce a high degree of distortion. A need therefore exists for an improved system and method for positioning and orienting a projective body.
Furthermore, conventional projective bodies used for projection texture mapping often don't "fit" surfaces very well, because they have limited degrees of freedom within which they can be altered. For instance, a sphere can only be altered by its radius, a cylinder only by its length and radius. Requiring a user to select an appropriate projective body can also lead to mistakes and poor texture mappings. A need therefore also exists for a projection texture mapping which uses a projective body that can be modified to better fit surfaces, preferably where the dimensions of the projective body are chosen automatically.